﻿Ext.define(Fsl.app.getAbsView('V01I002001X01'), {
    extend    : 'Ext.grid.Panel',
    alias     : Fsl.app.getAlias('V01I002001X01'),
    border    : true,
    modal     : true,
    height    : 300,
    width     : 300,
    viewConfig: {
        stripeRows    : true,
        forceFit      : true,
        emptyText     : 'No Records to display'
    },
    initComponent: function() {
		var me     = this,
		statusid   = 'win-statusbar-v01i002001';
        me.store   = Fsl.app.getRelStore('S01I002001');        
		me.tbar    = Fsl.tbar.getTB01I001(me.onCreate);
        me.bbar    = Fsl.bbar.getBB01I001(statusid);          
        me.columns = [{
				text            : 'SN',
				dataIndex       : 'id',
				width           : 40, 
				sortable        : false
			},{
				text            : 'Continent',
				dataIndex       : 'nameEn',
				flex            : 1
			},{
				text            : 'মহাদেশ',
				dataIndex       : 'nameBn',
				flex            : 1
			},{
				menuDisabled    : true,
				id              : 'delete-v01i002001',
				xtype           : 'actioncolumn',            
				width           : 22,            
				items           : [{
					icon        : Fsl.route.getImage('DEL01005.png'),
					tooltip     : 'Delete This?',
					scope       : this,
					handler     : function(grid, rowIdx, colIdx) {
						var record = grid.getStore().getAt(rowIdx);
						var conId  = record.data.id
						this.onDeleteClick(conId);
					}
				}]
			}
		]; 
        me.callParent(arguments);
    },    
    onCreate: function(btn, e, eOpts){
		Fsl.app.getWidget('V01I002001X02').show();
    },
    onDeleteClick : function(conId) {
		var me     = this,
		model      = 'M01I002001',
		values     = {id : conId},
		status     = 'win-statusbar-v01i002001';
		Fsl.mbox.destroy(me, model, values, status);
    }
});